Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable running most of bbin's test suite on a JVM #92

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

teodorlu
Copy link
Contributor

This PR enables a JVM-based workflow. The tests that pass without modification on a JVM can now be run on a JVM. The tests that fail on JVM only run on Babashka (for now).

In addition, test data has been updated to reflect the reality - per 2024-11-27, the latest version of org.babashka/http-server is 0.1.13.

Please answer the following questions and leave the below in as part of your PR.

This commit enables a JVM-based workflow. The tests that pass without
modification on a JVM can now be run on a JVM. The tests that fail on JVM now
only run on Babashka.

In addition, test data has been updated to reflect the reality - per 2024-11-27,
the latest version of org.babashka/http-server is 0.1.13.
@teodorlu teodorlu marked this pull request as draft November 27, 2024 22:05
bbin Outdated
[babashka.bbin.util :as util :refer [sh]]
[babashka.deps :as deps]
[babashka.bbin.util :as util :refer [sh whenbb]]
;; [babashka.deps :as deps]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out lines should be deleted!

bbin Outdated
Comment on lines 20 to 22
org.babashka/json {:mvn/version "0.1.1"}}})
ring/ring-core {:mvn/version "1.13.0"},
org.babashka/json {:mvn/version "0.1.1"},
http-kit/http-kit {:mvn/version "2.8.0"}}})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't expect these dependencies to make it into ./bbin - I propose to move these deps to the :dev alias to avoid adding depdendencies to bbin users.

.gitignore Outdated
@@ -27,3 +27,5 @@
/checkouts
/classes
/target

/deps.local.edn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No trailing final newline is ugly!

bbin Outdated
Comment on lines 749 to 752
(defmacro ifbb [then else]
(if (System/getProperty "babashka.version")
then
else))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifbb is not in use, and should be deleted.

[clojure.core.async :refer [<!] :as async]
[clojure.core.async :as async :refer [<!]]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My editor did this without me noticing, I'll revert it!

[babashka.bbin.util :as util :refer [sh]]
[babashka.deps :as deps]
[babashka.bbin.util :as util :refer [sh whenbb]]
;; [babashka.deps :as deps]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete out-commented line.

Comment on lines 327 to 330
(defmacro ifbb [then else]
(if (System/getProperty "babashka.version")
then
else))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifbb is not used, should be deleted.

Comment on lines 31 to +32
(def upgraded-lib
(assoc-in maven-lib [:coords :mvn/version] "0.1.12"))
(assoc-in maven-lib [:coords :mvn/version] "0.1.13"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a failing test on master too - 0.1.13 is the latest org.babashka/http-server version.

@teodorlu
Copy link
Contributor Author

In addition to the comments in the diff, I added Kaocha and Launchpad. I did that mostly out of habit, I like using the tools.

Thoughts? Do you prefer staying "leaner" with regards to tooling?

I added Launchpad to bb.edn. If that will cause Launchpad to be added to bbin user machines, it's behavior we maybe don't want.

@teodorlu teodorlu marked this pull request as ready for review November 27, 2024 22:14
@teodorlu teodorlu marked this pull request as draft November 27, 2024 22:19
@teodorlu
Copy link
Contributor Author

teodorlu commented Nov 27, 2024

From @borkdude on Slack:

can we get rid of those bin/ scripts and add those commands to bb tasks and swap koacha for the cognitect test runner, unless you're very attached to koacha? (edited)

https://clojurians.slack.com/archives/C02FBBU61A9/p1732745453495049?thread_ts=1732744901.186879&cid=C02FBBU61A9

I generally prefer to keep maps like this sorted, I find things more easily
then.

If there was some previous structure here that I didn't pick up, I'll revert.
Kaocha has become heavily ingrained into my workflow through
https://github.com/magnars/kaocha-runner.el. kaocha-runner requires that kaocha
is on the classpath in order to work.

Though that doesn't require that I put Kaocha into every project I work with.
Clojure 1.12's add-lib to the rescue!
The way I'd added Launchpad in a previous commit in this PR would be bad for all
bbin users: they would all be forced to download Launchpad. I don't want that.
Launchpad is a development helper, it shouldn't carry weight that influences
bbin users badly.

So I'm removing Launchpad.

We could possibly get around shipping Launchpad to bbin users by loading
launchpad dynamically in the `bb launchpad` task, but that's not worth it for me
for now.
@teodorlu
Copy link
Contributor Author

teodorlu commented Jan 3, 2025

I've removed Kaocha and Launchpad.

I like using Kaocha from within my Emacs, but I can load Kaocha with clojure.repl.deps/add-lib anyway — no reason to have two test runners (and possible confusion) in this project because of that. We do want the cognitect test runner to run tests on Babashka anyway.

As for Launchpad: Adding a Launchpad dep to bb.edn would cause everyone using bbin to have to download Launchpad, and I don't want that.


I still have to set up a deps.edn alias to run the tests with cognitect-test-runner on the JVM, and ensure it runs smoothly.

@teodorlu teodorlu changed the title Enable running (most of) bbin's test suite on a JVM Enable running most of bbin's test suite on a JVM Jan 3, 2025
@teodorlu
Copy link
Contributor Author

teodorlu commented Jan 3, 2025

@borkdude I think we're mostly there, but I'd like your thoughts on the tests that are failing in CI: https://github.com/teodorlu/bbin/actions/runs/12601558300/job/35122890533

My observations:

  1. I run local tests on bb (bb test) and on JVM (bb test:clj), all tests are green.
  2. I think I'm doing the same thing in CI, but in CI some of the tests are red on JVM.

It would also be helpful to know you get the CI behavior locally (red) or as I do (green).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant